<template>
    <div @touchstart="gotouchstart($event)" @touchcancel="tc" @touchmove="gotouchmove" @touchend="gotouchend">
        <slot></slot>
    </div>
</template>

<script>
export default {
    name:"viewContent",
    data (){
        return {
            timerId:null
        }
    },
    methods:{
        gotouchstart(event){
            if(this.timerId!=null){
                clearTimeout(this.timerId);
            }
           this.timerId =  setTimeout(()=>{
                this.$emit("longpress",event);
                clearTimeout(this.timerId);
                this.timerId=null;
            },600);
        },
        gotouchmove(){
            clearTimeout(this.timerId);
            this.timerId=null;
        },
        gotouchend(){
            clearTimeout(this.timerId);
            this.timerId=null;
        },
        tc(){
            clearTimeout(this.timerId);
            this.timerId=null;
        }
    }
}
</script>

<style>

</style>

